package com.project.purchase.Service.Imp;

import com.project.purchase.Service.IPerson;
import com.project.purchase.entity.Person;
import com.project.purchase.mapper.PersonMapper;
import com.project.purchase.vo.PersonWithDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author VX5
 * @Title: QZP
 * @ProjectName purchase
 * @Description: TODO
 * @date ${DAT}14:09
 */
@Service
public class PersonImp implements IPerson {
    @Autowired
    PersonMapper personMapper;


    @Override
    public List<PersonWithDept> GetAll() {
        return personMapper.GetAll();
    }

    @Override
    public List<PersonWithDept> GetByName(String name) {
        return personMapper.GetByName(name);
    }

    @Override
    public void deletByID(String id) {
        personMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void addPerson(Person person) {
        personMapper.insertSelective(person);
    }

    @Override
    public void updatePerson(Person person) {
        personMapper.updateByPrimaryKeySelective(person);
    }

    @Override
    public String GetIDByName(String name) {
        return personMapper.GetIDByName(name);
    }

    @Override
    public String GetIDByLoginName(String name) {
        return personMapper.GetIDByLoginName(name);
    }

}
